package com.aaa.sbm.controller;

import java.time.Duration;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;

/**
 * @FileName: A
 * @Description:
 * @Author: zhz
 * @CreateTime: 2024/6/22 17:51
 * @Version: 1.0.0
 */
public class A {
    public static String[] getAllTimeIntervals(int minutes) {
        int totalIntervals = 24 * 60 / minutes;
        String[] intervals = new String[totalIntervals];

        LocalTime currentTime = LocalTime.of(0, 0);
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm");

        for (int i = 0; i < totalIntervals; i++) {
            intervals[i] = currentTime.format(formatter);
            currentTime = currentTime.plusMinutes(minutes);
        }

        return intervals;
    }

    public static void main(String[] args) {
        String[] fiveMinuteIntervals = getAllTimeIntervals(5);
        for (String interval : fiveMinuteIntervals) {
            System.out.println(interval);
        }
    }
}
